import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
### so that u dont have warnings
from warnings import filterwarnings
filterwarnings('ignore')
url contains the url of the restaurant in the zomato website
address contains the address of the restaurant in Bengaluru
name contains the name of the restaurant
online_order whether online ordering is available in the restaurant or not
book_table table book option available or not
rate contains the overall rating of the restaurant out of 5
votes contains total number of rating for the restaurant as of the above mentioned date
phone contains the phone number of the restaurant
location contains the neighborhood in which the restaurant is located
rest_type restaurant type
dish_liked dishes people liked in the restaurant
cuisines food styles, separated by comma
approx_cost(for two people) contains the approximate cost for meal for two people
reviews_list list of tuples containing reviews for the restaurant, each tuple
menu_item contains list of menus available in the restaurant
listed_in(type) type of meal
listed_in(city) contains the neighborhood in which the restaurant is listed
#read dataset
df=pd.read_csv('zomato.csv')
df.head()
| url | address | name | online_order | book_table | rate | votes | phone | location | rest_type | dish_liked | cuisines | approx_cost(for two people) | reviews_list | menu_item | listed_in(type) | listed_in(city) | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | https://www.zomato.com/bangalore/jalsa-banasha... | 942, 21st Main Road, 2nd Stage, Banashankari, ... | Jalsa | Yes | Yes | 4.1/5 | 775 | 080 42297555\r\n+91 9743772233 | Banashankari | Casual Dining | Pasta, Lunch Buffet, Masala Papad, Paneer Laja... | North Indian, Mughlai, Chinese | 800 | [('Rated 4.0', 'RATED\n A beautiful place to ... | [] | Buffet | Banashankari |
| 1 | https://www.zomato.com/bangalore/spice-elephan... | 2nd Floor, 80 Feet Road, Near Big Bazaar, 6th ... | Spice Elephant | Yes | No | 4.1/5 | 787 | 080 41714161 | Banashankari | Casual Dining | Momos, Lunch Buffet, Chocolate Nirvana, Thai G... | Chinese, North Indian, Thai | 800 | [('Rated 4.0', 'RATED\n Had been here for din... | [] | Buffet | Banashankari |
| 2 | https://www.zomato.com/SanchurroBangalore?cont... | 1112, Next to KIMS Medical College, 17th Cross... | San Churro Cafe | Yes | No | 3.8/5 | 918 | +91 9663487993 | Banashankari | Cafe, Casual Dining | Churros, Cannelloni, Minestrone Soup, Hot Choc... | Cafe, Mexican, Italian | 800 | [('Rated 3.0', "RATED\n Ambience is not that ... | [] | Buffet | Banashankari |
| 3 | https://www.zomato.com/bangalore/addhuri-udupi... | 1st Floor, Annakuteera, 3rd Stage, Banashankar... | Addhuri Udupi Bhojana | No | No | 3.7/5 | 88 | +91 9620009302 | Banashankari | Quick Bites | Masala Dosa | South Indian, North Indian | 300 | [('Rated 4.0', "RATED\n Great food and proper... | [] | Buffet | Banashankari |
| 4 | https://www.zomato.com/bangalore/grand-village... | 10, 3rd Floor, Lakshmi Associates, Gandhi Baza... | Grand Village | No | No | 3.8/5 | 166 | +91 8026612447\r\n+91 9901210005 | Basavanagudi | Casual Dining | Panipuri, Gol Gappe | North Indian, Rajasthani | 600 | [('Rated 4.0', 'RATED\n Very good restaurant ... | [] | Buffet | Banashankari |
df.shape
(51717, 17)
df.dtypes
url object address object name object online_order object book_table object rate object votes int64 phone object location object rest_type object dish_liked object cuisines object approx_cost(for two people) object reviews_list object menu_item object listed_in(type) object listed_in(city) object dtype: object
len(df['name'].unique())
8792
df.isna().sum()
url 0 address 0 name 0 online_order 0 book_table 0 rate 7775 votes 0 phone 1208 location 21 rest_type 227 dish_liked 28078 cuisines 45 approx_cost(for two people) 346 reviews_list 0 menu_item 0 listed_in(type) 0 listed_in(city) 0 dtype: int64
feature_na=[feature for feature in df.columns if df[feature].isnull().sum()>0]
feature_na
['rate', 'phone', 'location', 'rest_type', 'dish_liked', 'cuisines', 'approx_cost(for two people)']
#% of missing values
for feature in feature_na:
print(f'{feature} has {np.round(((df[feature].isnull().sum()/len(df))*100),3)} % missing values')
rate has 15.034 % missing values phone has 2.336 % missing values location has 0.041 % missing values rest_type has 0.439 % missing values dish_liked has 54.292 % missing values cuisines has 0.087 % missing values approx_cost(for two people) has 0.669 % missing values
df['rate'].unique()
array(['4.1/5', '3.8/5', '3.7/5', '3.6/5', '4.6/5', '4.0/5', '4.2/5',
'3.9/5', '3.1/5', '3.0/5', '3.2/5', '3.3/5', '2.8/5', '4.4/5',
'4.3/5', 'NEW', '2.9/5', '3.5/5', nan, '2.6/5', '3.8 /5', '3.4/5',
'4.5/5', '2.5/5', '2.7/5', '4.7/5', '2.4/5', '2.2/5', '2.3/5',
'3.4 /5', '-', '3.6 /5', '4.8/5', '3.9 /5', '4.2 /5', '4.0 /5',
'4.1 /5', '3.7 /5', '3.1 /5', '2.9 /5', '3.3 /5', '2.8 /5',
'3.5 /5', '2.7 /5', '2.5 /5', '3.2 /5', '2.6 /5', '4.5 /5',
'4.3 /5', '4.4 /5', '4.9/5', '2.1/5', '2.0/5', '1.8/5', '4.6 /5',
'4.9 /5', '3.0 /5', '4.8 /5', '2.3 /5', '4.7 /5', '2.4 /5',
'2.1 /5', '2.2 /5', '2.0 /5', '1.8 /5'], dtype=object)
df.dropna(axis='index',subset=['rate'],inplace=True)
df.shape
(43942, 17)
def split(x):
return x.split('/')[0]
df['rate']=df['rate'].apply(split)
df.head()
| url | address | name | online_order | book_table | rate | votes | phone | location | rest_type | dish_liked | cuisines | approx_cost(for two people) | reviews_list | menu_item | listed_in(type) | listed_in(city) | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | https://www.zomato.com/bangalore/jalsa-banasha... | 942, 21st Main Road, 2nd Stage, Banashankari, ... | Jalsa | Yes | Yes | 4.1 | 775 | 080 42297555\r\n+91 9743772233 | Banashankari | Casual Dining | Pasta, Lunch Buffet, Masala Papad, Paneer Laja... | North Indian, Mughlai, Chinese | 800 | [('Rated 4.0', 'RATED\n A beautiful place to ... | [] | Buffet | Banashankari |
| 1 | https://www.zomato.com/bangalore/spice-elephan... | 2nd Floor, 80 Feet Road, Near Big Bazaar, 6th ... | Spice Elephant | Yes | No | 4.1 | 787 | 080 41714161 | Banashankari | Casual Dining | Momos, Lunch Buffet, Chocolate Nirvana, Thai G... | Chinese, North Indian, Thai | 800 | [('Rated 4.0', 'RATED\n Had been here for din... | [] | Buffet | Banashankari |
| 2 | https://www.zomato.com/SanchurroBangalore?cont... | 1112, Next to KIMS Medical College, 17th Cross... | San Churro Cafe | Yes | No | 3.8 | 918 | +91 9663487993 | Banashankari | Cafe, Casual Dining | Churros, Cannelloni, Minestrone Soup, Hot Choc... | Cafe, Mexican, Italian | 800 | [('Rated 3.0', "RATED\n Ambience is not that ... | [] | Buffet | Banashankari |
| 3 | https://www.zomato.com/bangalore/addhuri-udupi... | 1st Floor, Annakuteera, 3rd Stage, Banashankar... | Addhuri Udupi Bhojana | No | No | 3.7 | 88 | +91 9620009302 | Banashankari | Quick Bites | Masala Dosa | South Indian, North Indian | 300 | [('Rated 4.0', "RATED\n Great food and proper... | [] | Buffet | Banashankari |
| 4 | https://www.zomato.com/bangalore/grand-village... | 10, 3rd Floor, Lakshmi Associates, Gandhi Baza... | Grand Village | No | No | 3.8 | 166 | +91 8026612447\r\n+91 9901210005 | Basavanagudi | Casual Dining | Panipuri, Gol Gappe | North Indian, Rajasthani | 600 | [('Rated 4.0', 'RATED\n Very good restaurant ... | [] | Buffet | Banashankari |
df['rate'].unique()
array(['4.1', '3.8', '3.7', '3.6', '4.6', '4.0', '4.2', '3.9', '3.1',
'3.0', '3.2', '3.3', '2.8', '4.4', '4.3', 'NEW', '2.9', '3.5',
'2.6', '3.8 ', '3.4', '4.5', '2.5', '2.7', '4.7', '2.4', '2.2',
'2.3', '3.4 ', '-', '3.6 ', '4.8', '3.9 ', '4.2 ', '4.0 ', '4.1 ',
'3.7 ', '3.1 ', '2.9 ', '3.3 ', '2.8 ', '3.5 ', '2.7 ', '2.5 ',
'3.2 ', '2.6 ', '4.5 ', '4.3 ', '4.4 ', '4.9', '2.1', '2.0', '1.8',
'4.6 ', '4.9 ', '3.0 ', '4.8 ', '2.3 ', '4.7 ', '2.4 ', '2.1 ',
'2.2 ', '2.0 ', '1.8 '], dtype=object)
df.replace('NEW',0,inplace=True)
df.replace('-',0,inplace=True)
df['rate']=df['rate'].astype(float)
df.groupby('name')['rate'].mean().nlargest(20).plot.bar()
<AxesSubplot:xlabel='name'>
df_rate=df.groupby('name')['rate'].mean().to_frame()
df_rate=df_rate.reset_index()
df_rate.columns=['restaurant','rating']
df_rate.rating = round(df_rate.rating,2)
df_rate.head(20)
| restaurant | rating | |
|---|---|---|
| 0 | #FeelTheROLL | 3.40 |
| 1 | #L-81 Cafe | 3.90 |
| 2 | #refuel | 3.70 |
| 3 | 1000 B.C | 3.20 |
| 4 | 100ÃÂÃÂÃÂÃÂÃÂÃÂÃÂðC | 3.70 |
| 5 | 11 to 11 Express Biriyanis | 3.50 |
| 6 | 1131 Bar + Kitchen | 4.50 |
| 7 | 12th Main - Grand Mercure | 4.10 |
| 8 | 1441 Pizzeria | 4.10 |
| 9 | 1522 - The Pub | 4.21 |
| 10 | 154 Breakfast Club | 4.00 |
| 11 | 1722 Urban Bistro | 4.10 |
| 12 | 18+ Ice Cafe | 3.50 |
| 13 | 1947 | 4.02 |
| 14 | 1980s Games Cafe | 3.40 |
| 15 | 1992 Chats - Space | 3.70 |
| 16 | 1Q1 | 4.30 |
| 17 | 1TO3 Kitchen | 3.10 |
| 18 | 2 Statez | 3.70 |
| 19 | 20 Char - Sterlings MAC Hotel | 4.00 |
df_rate.shape
(7162, 2)
sns.set_style(style='darkgrid')
sns.distplot(df_rate['rating'])
<AxesSubplot:xlabel='rating', ylabel='Density'>
plt.figure(figsize=(10,7))
chains=df['name'].value_counts()[0:20]
sns.barplot(x=chains,y=chains.index,palette='deep')
plt.title("Most famous restaurants chains in Bangaluru",fontsize = 17)
plt.xlabel("Number of outlets")
Text(0.5, 0, 'Number of outlets')
x=df['online_order'].value_counts()
labels=['accepted','not accepted']
plt.pie(x,explode=[0.0,0.1],autopct='%1.1f%%',labels=labels)
([<matplotlib.patches.Wedge at 0x28dd6b09dc0>, <matplotlib.patches.Wedge at 0x28dd6b154f0>], [Text(-0.481488774517003, 0.9890240442042423, 'accepted'), Text(0.5252605823084886, -1.0789352717716423, 'not accepted')], [Text(-0.26263024064563795, 0.5394676604750411, '64.4%'), Text(0.30640200634661835, -0.629378908533458, '35.6%')])
!pip install plotly
Requirement already satisfied: plotly in d:\anaconda\lib\site-packages (5.1.0) Requirement already satisfied: tenacity>=6.2.0 in d:\anaconda\lib\site-packages (from plotly) (8.0.0) Requirement already satisfied: six in d:\anaconda\lib\site-packages (from plotly) (1.15.0)
import plotly.express as px
x=df['online_order'].value_counts()
labels=['accepted','not accepted']
fig = px.pie(values=x, names=labels,title='Pie chart')
fig.show()
import plotly.graph_objs as go
from plotly.offline import iplot
x=df['book_table'].value_counts()
labels=['not book','book']
trace=go.Pie(labels=labels, values=x,
hoverinfo='label+percent', textinfo='value',
textfont=dict(size=25),
pull=[ 0.2, 0]
)
iplot([trace])
df['rest_type'].isna().sum()
151
df['rest_type'].dropna(axis = 'index',inplace=True)
len(df['rest_type'].unique())
88
trace1 = go.Bar(
x = df['rest_type'].value_counts().nlargest(20).index,
y = df['rest_type'].value_counts().nlargest(20),
name= 'rest_type')
iplot([trace1])
trace1 = go.Bar(
x = df.groupby('name')['votes'].max().nlargest(10).index,
y = df.groupby('name')['votes'].max().nlargest(10),
name= ' highest voted')
iplot([trace1])
df.groupby('location')['name'].unique()
location
BTM [Sankranthi Veg Restaurant, Hearts Unlock Cafe...
Banashankari [Jalsa, Spice Elephant, San Churro Cafe, Addhu...
Banaswadi [Cafe Nibras, The Sanctuary, Crunch Pizzas, Pi...
Bannerghatta Road [Deja Vu Resto Bar, Fattoush, Empire Restauran...
Basavanagudi [Grand Village, Timepass Dinner, Srinathji's C...
...
West Bangalore [FreshMenu, Fit Dish Fetish, Garden City Mobil...
Whitefield [Imperio Cafe, Night Diaries, LocalHost, AB's ...
Wilson Garden [Tree Top, Sahana's (Nati Style), Karavali Kol...
Yelahanka [Prashanth Naati Corner, Cheta's Kitchen, Twis...
Yeshwantpur [Chef's Bank, New Agarwal Bhavan, Fishing Boat...
Name: name, Length: 92, dtype: object
restaurant=[]
location=[]
for key,location_df in df.groupby('location'):
location.append(key)
restaurant.append(len(location_df['name'].unique()))
df_total=pd.DataFrame(zip(location,restaurant))
df_total.columns=['location','restaurant']
df_total.set_index('location',inplace=True)
df_total.sort_values('restaurant').tail(10)
| restaurant | |
|---|---|
| location | |
| Bellandur | 284 |
| Jayanagar | 311 |
| Bannerghatta Road | 362 |
| JP Nagar | 400 |
| Indiranagar | 467 |
| Electronic City | 518 |
| Marathahalli | 525 |
| HSR | 553 |
| BTM | 581 |
| Whitefield | 634 |
df_total.sort_values(by='restaurant').tail(10).plot.bar()
<AxesSubplot:xlabel='location'>
df_total.sort_values(by='restaurant').tail(10).index
Index(['Bellandur', 'Jayanagar', 'Bannerghatta Road', 'JP Nagar',
'Indiranagar', 'Electronic City', 'Marathahalli', 'HSR', 'BTM',
'Whitefield'],
dtype='object', name='location')
trace1 = go.Bar(
x = df_total['restaurant'].nlargest(10).index,
y = df_total['restaurant'].nlargest(10),
name= 'Priority')
iplot([trace1])
df.isnull().sum()
url 0 address 0 name 0 online_order 0 book_table 0 rate 0 votes 0 phone 832 location 0 rest_type 151 dish_liked 20333 cuisines 11 approx_cost(for two people) 252 reviews_list 0 menu_item 0 listed_in(type) 0 listed_in(city) 0 dtype: int64
df['cuisines']
0 North Indian, Mughlai, Chinese
1 Chinese, North Indian, Thai
2 Cafe, Mexican, Italian
3 South Indian, North Indian
4 North Indian, Rajasthani
...
51709 North Indian, Continental
51711 Andhra, South Indian, Chinese, North Indian
51712 Continental
51715 Finger Food
51716 Finger Food, North Indian, Continental
Name: cuisines, Length: 43942, dtype: object
cuisines=df['cuisines'].value_counts()[:10]
sns.barplot(cuisines,cuisines.index)
plt.xlabel('Count')
plt.title("Most popular cuisines of Bangalore")
Text(0.5, 1.0, 'Most popular cuisines of Bangalore')
cuisines=df['cuisines'].value_counts()[:10]
trace1 = go.Bar(
x = cuisines.index,
y = cuisines,
name= 'Cuisines')
iplot([trace1])
len(df['approx_cost(for two people)'].value_counts())
66
df['approx_cost(for two people)'].isna().sum()
252
df.dropna(axis='index',subset=['approx_cost(for two people)'],inplace=True)
df['approx_cost(for two people)'].isna().sum()
0
df['approx_cost(for two people)'].unique()
array(['800', '300', '600', '700', '550', '500', '450', '650', '400',
'900', '200', '750', '150', '850', '100', '1,200', '350', '250',
'950', '1,000', '1,500', '1,300', '199', '80', '1,100', '160',
'1,600', '230', '130', '1,700', '1,400', '1,350', '2,200', '2,000',
'1,800', '1,900', '180', '330', '2,500', '2,100', '3,000', '2,800',
'3,400', '50', '40', '1,250', '3,500', '4,000', '2,400', '2,600',
'1,450', '70', '3,200', '560', '240', '360', '6,000', '1,050',
'2,300', '4,100', '120', '5,000', '3,700', '1,650', '2,700',
'4,500'], dtype=object)
df['approx_cost(for two people)'].dtype
dtype('O')
type(df['approx_cost(for two people)'][0])
str
df['approx_cost(for two people)'] = df['approx_cost(for two people)'].apply(lambda x: x.replace(',',''))
df['approx_cost(for two people)']=df['approx_cost(for two people)'].astype(int)
plt.figure(figsize=(14,7))
sns.scatterplot(x="rate",y='approx_cost(for two people)',hue='online_order',data=df)
plt.show()
from this scattterplot,we can come up with a conclusion THAT most of the highest rated restaurants accepts online order and they are in budget
df.head()
| url | address | name | online_order | book_table | rate | votes | phone | location | rest_type | dish_liked | cuisines | approx_cost(for two people) | reviews_list | menu_item | listed_in(type) | listed_in(city) | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | https://www.zomato.com/bangalore/jalsa-banasha... | 942, 21st Main Road, 2nd Stage, Banashankari, ... | Jalsa | Yes | Yes | 4.1 | 775 | 080 42297555\r\n+91 9743772233 | Banashankari | Casual Dining | Pasta, Lunch Buffet, Masala Papad, Paneer Laja... | North Indian, Mughlai, Chinese | 800 | [('Rated 4.0', 'RATED\n A beautiful place to ... | [] | Buffet | Banashankari |
| 1 | https://www.zomato.com/bangalore/spice-elephan... | 2nd Floor, 80 Feet Road, Near Big Bazaar, 6th ... | Spice Elephant | Yes | No | 4.1 | 787 | 080 41714161 | Banashankari | Casual Dining | Momos, Lunch Buffet, Chocolate Nirvana, Thai G... | Chinese, North Indian, Thai | 800 | [('Rated 4.0', 'RATED\n Had been here for din... | [] | Buffet | Banashankari |
| 2 | https://www.zomato.com/SanchurroBangalore?cont... | 1112, Next to KIMS Medical College, 17th Cross... | San Churro Cafe | Yes | No | 3.8 | 918 | +91 9663487993 | Banashankari | Cafe, Casual Dining | Churros, Cannelloni, Minestrone Soup, Hot Choc... | Cafe, Mexican, Italian | 800 | [('Rated 3.0', "RATED\n Ambience is not that ... | [] | Buffet | Banashankari |
| 3 | https://www.zomato.com/bangalore/addhuri-udupi... | 1st Floor, Annakuteera, 3rd Stage, Banashankar... | Addhuri Udupi Bhojana | No | No | 3.7 | 88 | +91 9620009302 | Banashankari | Quick Bites | Masala Dosa | South Indian, North Indian | 300 | [('Rated 4.0', "RATED\n Great food and proper... | [] | Buffet | Banashankari |
| 4 | https://www.zomato.com/bangalore/grand-village... | 10, 3rd Floor, Lakshmi Associates, Gandhi Baza... | Grand Village | No | No | 3.8 | 166 | +91 8026612447\r\n+91 9901210005 | Basavanagudi | Casual Dining | Panipuri, Gol Gappe | North Indian, Rajasthani | 600 | [('Rated 4.0', 'RATED\n Very good restaurant ... | [] | Buffet | Banashankari |
fig = px.box(df,x='online_order',y='approx_cost(for two people)')
fig.show()
Restaurants accepting online orders are more affordable than Restaurants who are accepting online orders
df['approx_cost(for two people)'].min()
40
df['approx_cost(for two people)'].max()
6000
df[df['approx_cost(for two people)']==6000]
| url | address | name | online_order | book_table | rate | votes | phone | location | rest_type | dish_liked | cuisines | approx_cost(for two people) | reviews_list | menu_item | listed_in(type) | listed_in(city) | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 19139 | https://www.zomato.com/bangalore/le-cirque-sig... | The Leela Palace, 23, Old Airport Road, Bangalore | Le Cirque Signature - The Leela Palace | No | Yes | 4.3 | 126 | 080 30571234\r\n080 30571540 | Old Airport Road | Fine Dining | Wine, Asparagus Soup, Creme Brulee, Pasta, Rav... | French, Italian | 6000 | [('Rated 5.0', 'RATED\n Awesome would be an u... | [] | Dine-out | Indiranagar |
| 45618 | https://www.zomato.com/bangalore/le-cirque-sig... | The Leela Palace, 23, Old Airport Road, Bangalore | Le Cirque Signature - The Leela Palace | No | Yes | 4.3 | 128 | 080 30571234\n080 30571540 | Old Airport Road | Fine Dining | Wine, Asparagus Soup, Creme Brulee, Pasta, Rav... | French, Italian | 6000 | [('Rated 5.0', 'RATED\n Awesome would be an u... | [] | Dine-out | Old Airport Road |
df[df['approx_cost(for two people)']==6000]['name']
19139 Le Cirque Signature - The Leela Palace 45618 Le Cirque Signature - The Leela Palace Name: name, dtype: object
sns.set_style('dark')
plt.figure(figsize=(14,7))
sns.distplot(df['approx_cost(for two people)'])
plt.show()
df[df['approx_cost(for two people)']==6000][['name','cuisines','dish_liked']]
| name | cuisines | dish_liked | |
|---|---|---|---|
| 19139 | Le Cirque Signature - The Leela Palace | French, Italian | Wine, Asparagus Soup, Creme Brulee, Pasta, Rav... |
| 45618 | Le Cirque Signature - The Leela Palace | French, Italian | Wine, Asparagus Soup, Creme Brulee, Pasta, Rav... |
data=df.copy()
data.dtypes
url object address object name object online_order object book_table object rate float64 votes int64 phone object location object rest_type object dish_liked object cuisines object approx_cost(for two people) int32 reviews_list object menu_item object listed_in(type) object listed_in(city) object dtype: object
data.set_index('name',inplace=True)
data['approx_cost(for two people)'].nlargest(10).plot.bar()
<AxesSubplot:xlabel='name'>
trace1 = go.Bar(
x = data['approx_cost(for two people)'].nsmallest(10).index,
y = data['approx_cost(for two people)'].nsmallest(10),
name= 'Priority')
iplot([trace1])
data[data['approx_cost(for two people)']<=500]
| url | address | online_order | book_table | rate | votes | phone | location | rest_type | dish_liked | cuisines | approx_cost(for two people) | reviews_list | menu_item | listed_in(type) | listed_in(city) | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| name | ||||||||||||||||
| Addhuri Udupi Bhojana | https://www.zomato.com/bangalore/addhuri-udupi... | 1st Floor, Annakuteera, 3rd Stage, Banashankar... | No | No | 3.7 | 88 | +91 9620009302 | Banashankari | Quick Bites | Masala Dosa | South Indian, North Indian | 300 | [('Rated 4.0', "RATED\n Great food and proper... | [] | Buffet | Banashankari |
| CafÃÂÃÂÃÂÃÂÃÂÃÂÃÂé Down The Alley | https://www.zomato.com/bangalore/caf%C3%A9-dow... | 12,29 Near PES University Back Gate, D'Souza N... | Yes | No | 4.1 | 402 | 080 26724489\r\n+91 7406048982 | Banashankari | Cafe | Waffles, Pasta, Crispy Chicken, Honey Chilli C... | Cafe | 500 | [('Rated 4.0', 'RATED\n We ended up here on a... | [] | Cafes | Banashankari |
| The Coffee Shack | https://www.zomato.com/bangalore/the-coffee-sh... | 6th Block, 3rd Stage, Banashankari, Bangalore | Yes | Yes | 4.2 | 164 | +91 9731644212 | Banashankari | Cafe | Coffee, Spaghetti, Pancakes, Nachos, Pasta, Sa... | Cafe, Chinese, Continental, Italian | 500 | [('Rated 4.0', "RATED\n Food - 4/5\nAmbience ... | [] | Cafes | Banashankari |
| Caf-Eleven | https://www.zomato.com/bangalore/caf-eleven-ba... | 111, Sapphire Toys Building, 100 Feet Ring Roa... | No | No | 4.0 | 424 | 080 49577715 | Banashankari | Cafe | Sandwich, Omelette, Ice Tea, Virgin Mojito, Ho... | Cafe, Continental | 450 | [('Rated 2.0', "RATED\n This is a hookah cafe... | [] | Cafes | Banashankari |
| T3H Cafe | https://www.zomato.com/bangalore/t3h-cafe-bana... | 504, CJ Venkata Das Road, Padmanabhangar, 2nd ... | No | No | 3.9 | 93 | +91 8884726600 | Banashankari | Cafe | Cheese Maggi, Peri Peri Fries, Pasta Arrabiata | Cafe, Italian, American | 300 | [('Rated 4.0', "RATED\n Happy to see such a c... | [] | Cafes | Banashankari |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| Venice Kerala Restaurant | https://www.zomato.com/bangalore/venice-kerala... | Opposite Brookfield Mall, Shiva Temple Road, B... | No | No | 3.7 | 34 | +91 8880059495 | Brookefield | Quick Bites | NaN | Kerala | 200 | [('Rated 5.0', 'RATED\n Loved this restaurant... | [] | Dine-out | Whitefield |
| Thai & Chinese Fast Food | https://www.zomato.com/bangalore/thai-chinese-... | 7, Anurhh Arcade, Hoodi Road, Kodigehalli Road... | No | No | 3.4 | 7 | +91 9206260085\n+91 7619416923 | KR Puram | Quick Bites | NaN | Chinese, Thai | 400 | [('Rated 5.0', 'RATED\n Its Looking delicious... | [] | Dine-out | Whitefield |
| The Crunch | https://www.zomato.com/bangalore/the-crunch-br... | 33/1, Kundalahalli Road, Brookefield, Bangalore | No | No | 3.3 | 6 | +91 9016277963 | Brookefield | Beverage Shop | NaN | Beverages | 300 | [('Rated 3.0', 'RATED\n the sandwich was not ... | [] | Dine-out | Whitefield |
| Punjabi Charchay | https://www.zomato.com/bangalore/punjabi-charc... | 7, Anurhh Arcade, Hoodi Road, Kodigehalli Road... | No | No | 3.6 | 31 | +91 9341341916\n+91 7619416499 | KR Puram | Quick Bites | NaN | North Indian, Chinese | 400 | [('Rated 3.0', 'RATED\n A nice little place f... | [] | Dine-out | Whitefield |
| Raapchick | https://www.zomato.com/bangalore/raapchick-bro... | Opposite Brookefield Mall, Kundanhalli, Brooke... | Yes | No | 3.6 | 49 | 080 41717785\n+91 9571153004 | Brookefield | Quick Bites | Burgers | Fast Food, Burger | 300 | [('Rated 5.0', "RATED\n I was randomly lookin... | ['Chicken Wrap', 'Veg Crunch Burger', 'Spicy P... | Dine-out | Whitefield |
26330 rows × 16 columns
df_new=df[df['approx_cost(for two people)']<=500]
len(df_new['name'].unique())
4936
location=[]
total=[]
for loc,location_df in df_new.groupby('location'):
location.append(loc)
total.append(len(location_df['name'].unique()))
len(location)
90
len(total)
90
location_df=pd.DataFrame(zip(location,total))
location_df.columns=['location','restaurant']
location_df.set_index('location',inplace=True)
location_df.head(20)
| restaurant | |
|---|---|
| location | |
| BTM | 482 |
| Banashankari | 186 |
| Banaswadi | 116 |
| Bannerghatta Road | 262 |
| Basavanagudi | 161 |
| Basaveshwara Nagar | 52 |
| Bellandur | 197 |
| Bommanahalli | 49 |
| Brigade Road | 61 |
| Brookefield | 113 |
| CV Raman Nagar | 26 |
| Central Bangalore | 2 |
| Church Street | 18 |
| City Market | 20 |
| Commercial Street | 28 |
| Cunningham Road | 21 |
| Domlur | 55 |
| East Bangalore | 15 |
| Ejipura | 42 |
| Electronic City | 373 |
type(location)
list
location_df['restaurant'].nlargest(10).plot.bar()
plt.gcf().autofmt_xdate()
plt.ylabel('Total restaurants')
Text(0, 0.5, 'Total restaurants')
trace1 = go.Bar(
x = location_df['restaurant'].nlargest(10).index,
y = location_df['restaurant'].nlargest(10),
name= 'Priority')
iplot([trace1])
location=[]
total=[]
for loc,location_df in df_new.groupby('location'):
location.append(loc)
total.append(location_df['name'].unique())
afford=pd.DataFrame(zip(location,total))
afford.columns=['location','res_names']
afford.set_index('location',inplace=True)
afford.head()
| res_names | |
|---|---|
| location | |
| BTM | [Hearts Unlock Cafe, eat.fit, Hiyar Majhe Kolk... |
| Banashankari | [Addhuri Udupi Bhojana, CafÃÂÃÂÃÂÃÂÃÂ... |
| Banaswadi | [Cafe Nibras, The Sanctuary, Pizza Stop, Crunc... |
| Bannerghatta Road | [Tisano Cafe, Butterly, Black Mug Cafe, #refue... |
| Basavanagudi | [Chaatimes, Chinese Kitchen, Kabab Magic, Sri ... |
def return_budget(location,restaurant):
budget=df[(df['approx_cost(for two people)']<=400) & (df['location']==location)
& (df['rest_type']==restaurant)]
return(budget['name'].unique())
return_budget('BTM',"Cafe")
array(['Kullad Cafe', 'Insta Cafe', 'Black Cup Cafe', 'Cafe 221B',
'Coco Barista', 'Cafe Orio', 'Cafe Longing'], dtype=object)
plt.figure(figsize=(10,7))
Restaurant_locations=df['location'].value_counts()[:20]
sns.barplot(Restaurant_locations,Restaurant_locations.index)
<AxesSubplot:xlabel='location'>
Restaurant_locations=df['location'].value_counts()[:20]
trace1 = go.Bar(
x = Restaurant_locations.index,
y = Restaurant_locations,
name= 'Priority')
iplot([trace1])
df.shape
(43690, 17)
len(df['location'].unique())
92
locations=pd.DataFrame({"Name":df['location'].unique()})
locations['new_Name']='Bangalore '+locations['Name']
locations.head()
| Name | new_Name | |
|---|---|---|
| 0 | Banashankari | Bangalore Banashankari |
| 1 | Basavanagudi | Bangalore Basavanagudi |
| 2 | Mysore Road | Bangalore Mysore Road |
| 3 | Jayanagar | Bangalore Jayanagar |
| 4 | Kumaraswamy Layout | Bangalore Kumaraswamy Layout |
!pip install geopy
Requirement already satisfied: geopy in d:\anaconda\lib\site-packages (2.2.0) Requirement already satisfied: geographiclib<2,>=1.49 in d:\anaconda\lib\site-packages (from geopy) (1.52)
from geopy.geocoders import Nominatim
lat_lon=[]
geolocator=Nominatim(user_agent="app")
for location in locations['Name']:
location = geolocator.geocode(location)
if location is None:
lat_lon.append(np.nan)
else:
geo=(location.latitude,location.longitude)
lat_lon.append(geo)
locations['geo_loc']=lat_lon
locations.head()
| Name | new_Name | geo_loc | |
|---|---|---|---|
| 0 | Banashankari | Bangalore Banashankari | (15.8876779, 75.7046777) |
| 1 | Basavanagudi | Bangalore Basavanagudi | (12.9417261, 77.5755021) |
| 2 | Mysore Road | Bangalore Mysore Road | (12.3872141, 76.6669626) |
| 3 | Jayanagar | Bangalore Jayanagar | (27.64392675, 83.05280519687284) |
| 4 | Kumaraswamy Layout | Bangalore Kumaraswamy Layout | (12.9081487, 77.5553179) |
locations.to_csv('zomato_locations.csv',index=False)
Rest_locations=pd.DataFrame(df['location'].value_counts().reset_index())
Rest_locations.columns=['Name','count']
Rest_locations.head()
| Name | count | |
|---|---|---|
| 0 | BTM | 4237 |
| 1 | Koramangala 5th Block | 2358 |
| 2 | HSR | 2113 |
| 3 | Indiranagar | 1892 |
| 4 | JP Nagar | 1849 |
locations.head()
| Name | new_Name | geo_loc | |
|---|---|---|---|
| 0 | Banashankari | Bangalore Banashankari | (15.8876779, 75.7046777) |
| 1 | Basavanagudi | Bangalore Basavanagudi | (12.9417261, 77.5755021) |
| 2 | Mysore Road | Bangalore Mysore Road | (12.3872141, 76.6669626) |
| 3 | Jayanagar | Bangalore Jayanagar | (27.64392675, 83.05280519687284) |
| 4 | Kumaraswamy Layout | Bangalore Kumaraswamy Layout | (12.9081487, 77.5553179) |
locations.shape
(92, 3)
Rest_locations.shape
(92, 2)
Restaurant_locations=Rest_locations.merge(locations,on='Name',how="left").dropna()
Restaurant_locations.shape
(91, 4)
Restaurant_locations['count'].max()
4237
type(Restaurant_locations['geo_loc'][0])
tuple
def generateBaseMap(default_location=[12.97, 77.59], default_zoom_start=12):
base_map = folium.Map(location=default_location, zoom_start=default_zoom_start)
return base_map
Restaurant_locations.isna().sum()
Name 0 count 0 new_Name 0 geo_loc 0 dtype: int64
Restaurant_locations['geo_loc'][0][0]
45.95485055
Restaurant_locations['geo_loc'][0][1]
-112.49659530324134
#### unzip it
lat,lon=zip(*Restaurant_locations['geo_loc'])
type(lat)
tuple
Restaurant_locations['lat']=lat
Restaurant_locations['lon']=lon
Restaurant_locations.head()
| Name | count | new_Name | geo_loc | lat | lon | |
|---|---|---|---|---|---|---|
| 0 | BTM | 4237 | Bangalore BTM | (45.95485055, -112.49659530324134) | 45.954851 | -112.496595 |
| 1 | Koramangala 5th Block | 2358 | Bangalore Koramangala 5th Block | (12.9343774, 77.628415) | 12.934377 | 77.628415 |
| 2 | HSR | 2113 | Bangalore HSR | (18.1475, 41.538889) | 18.147500 | 41.538889 |
| 3 | Indiranagar | 1892 | Bangalore Indiranagar | (12.9732913, 77.6404672) | 12.973291 | 77.640467 |
| 4 | JP Nagar | 1849 | Bangalore JP Nagar | (12.2655944, 76.6465404) | 12.265594 | 76.646540 |
!pip install folium
Requirement already satisfied: folium in d:\anaconda\lib\site-packages (0.12.1) Requirement already satisfied: branca>=0.3.0 in d:\anaconda\lib\site-packages (from folium) (0.4.2) Requirement already satisfied: jinja2>=2.9 in d:\anaconda\lib\site-packages (from folium) (2.11.3) Requirement already satisfied: numpy in d:\anaconda\lib\site-packages (from folium) (1.20.1) Requirement already satisfied: requests in d:\anaconda\lib\site-packages (from folium) (2.25.1) Requirement already satisfied: MarkupSafe>=0.23 in d:\anaconda\lib\site-packages (from jinja2>=2.9->folium) (1.1.1) Requirement already satisfied: urllib3<1.27,>=1.21.1 in d:\anaconda\lib\site-packages (from requests->folium) (1.26.4) Requirement already satisfied: chardet<5,>=3.0.2 in d:\anaconda\lib\site-packages (from requests->folium) (4.0.0) Requirement already satisfied: certifi>=2017.4.17 in d:\anaconda\lib\site-packages (from requests->folium) (2020.12.5) Requirement already satisfied: idna<3,>=2.5 in d:\anaconda\lib\site-packages (from requests->folium) (2.10)
import folium
from folium.plugins import HeatMap
basemap=generateBaseMap()
basemap
Restaurant_locations[['lat','lon','count']].values.tolist()
[[45.95485055, -112.49659530324134, 4237.0], [12.9343774, 77.628415, 2358.0], [18.1475, 41.538889, 2113.0], [12.9732913, 77.6404672, 1892.0], [12.2655944, 76.6465404, 1849.0], [27.64392675, 83.05280519687284, 1711.0], [44.3730577, -71.6118577, 1688.0], [12.9552572, 77.6984163, 1488.0], [12.887979, 77.5970812, 1318.0], [12.9400321, 77.6203272, 1103.0], [12.9302645, 77.6332585, 1084.0], [40.28745, -76.964526, 1084.0], [12.93577245, 77.66676103753434, 1078.0], [14.5395813, 121.070371, 964.0], [-6.2659285, 106.7842561, 963.0], [12.9242381, 77.6289059, 913.0], [12.9778793, 77.6246697, 901.0], [12.93433385, 77.63040639553275, 864.0], [29.4534927, -98.6440138, 818.0], [15.8876779, 75.7046777, 805.0], [13.0221416, 77.6403368, 745.0], [13.0027353, 77.5703253, 657.0], [12.9417261, 77.5755021, 628.0], [50.7721586, 0.09772783661369303, 626.0], [38.7385916, -77.5275749, 607.0], [33.5935063, -79.0345627, 579.0], [12.996845, 77.6130165, 574.0], [40.7160591, -74.0070597, 550.0], [13.0093455, 77.6377094, 522.0], [13.0346384, 77.5681733, 521.0], [40.7652844, -76.373824, 493.0], [13.0141618, 77.6518539, 491.0], [12.9882338, 77.554883, 487.0], [31.89376, -88.066644, 475.0], [12.9624669, 77.6381958, 426.0], [12.9575547, 77.5979099, 390.0], [62.442403, -114.3987951, 383.0], [51.5230784, -0.7374421, 343.0], [51.5154481, -0.0720271, 309.0], [12.945245, 77.6269144, 292.0], [18.5322493, 73.8499601124847, 277.0], [12.9678074, 77.6568367, 262.0], [12.988721250000001, 77.58516877601824, 252.0], [12.9417812, 77.6160146, 227.0], [12.9489339, 77.5968273, 203.0], [12.9271867, 77.6266252, 193.0], [12.9081487, 77.5553179, 168.0], [13.2227, 78.5541977, 165.0], [12.9089453, 77.6239038, 157.0], [12.973936, 77.6509982, 152.0], [12.9931876, 77.5753419, 142.0], [12.9932739, 77.5388099, 141.0], [34.977289, -78.974578, 140.0], [1.306731, 103.8497839, 137.0], [13.0258087, 77.6305067, 129.0], [1.2847055, 103.84320655721689, 118.0], [13.02383, 77.5529215, 112.0], [13.0358698, 77.6323597, 111.0], [12.9243509, 77.6255562, 92.0], [12.9414662, 77.7470942, 91.0], [12.9846713, 77.6790908, 91.0], [13.0646907, 77.49626895712257, 91.0], [12.967576, 77.7150877, 84.0], [39.76880625, -86.15345077251979, 77.0], [12.773175, 77.7831871, 74.0], [6.9233338, 93.9046149, 69.0], [17.2510682, 80.1651978, 66.0], [13.0227204, 77.595715, 63.0], [15.8782951, 74.5084834, 58.0], [23.1485712, 81.6048241, 50.0], [13.0621474, 77.58006135480495, 47.0], [13.2923988, 77.7519261, 31.0], [13.0215466, 77.7640586, 30.0], [12.957998, 77.6037312, 27.0], [38.7801076, -121.5056438, 26.0], [12.945048, 77.263004, 24.0], [11.9917786, 76.5066292, 23.0], [12.9970537, 77.669804, 22.0], [12.5607431, 77.4258375, 19.0], [12.3872141, 76.6669626, 18.0], [13.0217151, 77.7660547, 14.0], [13.007516, 77.695935, 11.0], [13.0382184, 77.5919, 10.0], [12.9055682, 77.5455438, 9.0], [12.9176571, 77.4837568, 9.0], [13.0101286, 77.5548006, 8.0], [13.0011289, 77.6325617, 5.0], [13.1006982, 77.5963454, 4.0], [12.9274413, 77.5155224, 2.0], [12.9546741, 77.5121724, 1.0], [13.0329419, 77.5273253, 1.0]]
HeatMap(Restaurant_locations[['lat','lon','count']].values.tolist(),zoom=20,radius=15).add_to(basemap)
<folium.plugins.heat_map.HeatMap at 0x28df72f3f70>
basemap
df.head()
| url | address | name | online_order | book_table | rate | votes | phone | location | rest_type | dish_liked | cuisines | approx_cost(for two people) | reviews_list | menu_item | listed_in(type) | listed_in(city) | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | https://www.zomato.com/bangalore/jalsa-banasha... | 942, 21st Main Road, 2nd Stage, Banashankari, ... | Jalsa | Yes | Yes | 4.1 | 775 | 080 42297555\r\n+91 9743772233 | Banashankari | Casual Dining | Pasta, Lunch Buffet, Masala Papad, Paneer Laja... | North Indian, Mughlai, Chinese | 800 | [('Rated 4.0', 'RATED\n A beautiful place to ... | [] | Buffet | Banashankari |
| 1 | https://www.zomato.com/bangalore/spice-elephan... | 2nd Floor, 80 Feet Road, Near Big Bazaar, 6th ... | Spice Elephant | Yes | No | 4.1 | 787 | 080 41714161 | Banashankari | Casual Dining | Momos, Lunch Buffet, Chocolate Nirvana, Thai G... | Chinese, North Indian, Thai | 800 | [('Rated 4.0', 'RATED\n Had been here for din... | [] | Buffet | Banashankari |
| 2 | https://www.zomato.com/SanchurroBangalore?cont... | 1112, Next to KIMS Medical College, 17th Cross... | San Churro Cafe | Yes | No | 3.8 | 918 | +91 9663487993 | Banashankari | Cafe, Casual Dining | Churros, Cannelloni, Minestrone Soup, Hot Choc... | Cafe, Mexican, Italian | 800 | [('Rated 3.0', "RATED\n Ambience is not that ... | [] | Buffet | Banashankari |
| 3 | https://www.zomato.com/bangalore/addhuri-udupi... | 1st Floor, Annakuteera, 3rd Stage, Banashankar... | Addhuri Udupi Bhojana | No | No | 3.7 | 88 | +91 9620009302 | Banashankari | Quick Bites | Masala Dosa | South Indian, North Indian | 300 | [('Rated 4.0', "RATED\n Great food and proper... | [] | Buffet | Banashankari |
| 4 | https://www.zomato.com/bangalore/grand-village... | 10, 3rd Floor, Lakshmi Associates, Gandhi Baza... | Grand Village | No | No | 3.8 | 166 | +91 8026612447\r\n+91 9901210005 | Basavanagudi | Casual Dining | Panipuri, Gol Gappe | North Indian, Rajasthani | 600 | [('Rated 4.0', 'RATED\n Very good restaurant ... | [] | Buffet | Banashankari |
df2= df[df['cuisines']=='North Indian']
df2.head()
| url | address | name | online_order | book_table | rate | votes | phone | location | rest_type | dish_liked | cuisines | approx_cost(for two people) | reviews_list | menu_item | listed_in(type) | listed_in(city) | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 5 | https://www.zomato.com/bangalore/timepass-dinn... | 37, 5-1, 4th Floor, Bosco Court, Gandhi Bazaar... | Timepass Dinner | Yes | No | 3.8 | 286 | +91 9980040002\r\n+91 9980063005 | Basavanagudi | Casual Dining | Onion Rings, Pasta, Kadhai Paneer, Salads, Sal... | North Indian | 600 | [('Rated 3.0', 'RATED\n Food 3/5\nAmbience 3/... | [] | Buffet | Banashankari |
| 50 | https://www.zomato.com/bangalore/petoo-banasha... | 276, Ground Floor, 100 Feet Outer Ring Road, B... | Petoo | No | No | 3.7 | 21 | +91 8026893211 | Banashankari | Quick Bites | NaN | North Indian | 450 | [('Rated 2.0', 'RATED\n This is a neatly made... | [] | Delivery | Banashankari |
| 72 | https://www.zomato.com/bangalore/spicy-tandoor... | Opposite ICICi Bank, Hanuman Nagar, Banashanka... | Spicy Tandoor | No | No | 0.0 | 0 | +91 8050884222 | Banashankari | Quick Bites | NaN | North Indian | 150 | [('Rated 4.0', 'RATED\n cost for chicken roll... | [] | Delivery | Banashankari |
| 87 | https://www.zomato.com/bangalore/krishna-sagar... | 38, 22nd Main, 22nd Cross, Opposite BDA, 2nd S... | Krishna Sagar | No | No | 3.5 | 31 | +91 8892752997\r\n+91 7204780429 | Banashankari | Quick Bites | NaN | North Indian | 200 | [('Rated 1.0', 'RATED\n Worst experience with... | [] | Delivery | Banashankari |
| 94 | https://www.zomato.com/bangalore/nandhini-delu... | 304, Opposite Apollo Public School, 100 Feet R... | Nandhini Deluxe | No | No | 2.6 | 283 | 080 26890011\r\n080 26890033 | Banashankari | Casual Dining | Biryani, Chicken Guntur, Thali, Buttermilk, Ma... | North Indian | 600 | [('Rated 3.0', 'RATED\n Ididnt like much.\n\n... | [] | Delivery | Banashankari |
north_india=pd.DataFrame(df['location'].value_counts().reset_index())
north_india.columns=['Name','count']
north_india.head()
| Name | count | |
|---|---|---|
| 0 | BTM | 4237 |
| 1 | Koramangala 5th Block | 2358 |
| 2 | HSR | 2113 |
| 3 | Indiranagar | 1892 |
| 4 | JP Nagar | 1849 |
north_india=north_india.merge(locations,on="Name",how='left').dropna()
north_india.head()
| Name | count | new_Name | geo_loc | |
|---|---|---|---|---|
| 0 | BTM | 4237 | Bangalore BTM | (45.95485055, -112.49659530324134) |
| 1 | Koramangala 5th Block | 2358 | Bangalore Koramangala 5th Block | (12.9343774, 77.628415) |
| 2 | HSR | 2113 | Bangalore HSR | (18.1475, 41.538889) |
| 3 | Indiranagar | 1892 | Bangalore Indiranagar | (12.9732913, 77.6404672) |
| 4 | JP Nagar | 1849 | Bangalore JP Nagar | (12.2655944, 76.6465404) |
north_india['lan'],north_india['lon']=zip(*north_india['geo_loc'].values)
north_india.drop(['geo_loc'],axis=1)
| Name | count | new_Name | lan | lon | |
|---|---|---|---|---|---|
| 0 | BTM | 4237 | Bangalore BTM | 45.954851 | -112.496595 |
| 1 | Koramangala 5th Block | 2358 | Bangalore Koramangala 5th Block | 12.934377 | 77.628415 |
| 2 | HSR | 2113 | Bangalore HSR | 18.147500 | 41.538889 |
| 3 | Indiranagar | 1892 | Bangalore Indiranagar | 12.973291 | 77.640467 |
| 4 | JP Nagar | 1849 | Bangalore JP Nagar | 12.265594 | 76.646540 |
| ... | ... | ... | ... | ... | ... |
| 87 | West Bangalore | 5 | Bangalore West Bangalore | 13.001129 | 77.632562 |
| 88 | Yelahanka | 4 | Bangalore Yelahanka | 13.100698 | 77.596345 |
| 89 | Rajarajeshwari Nagar | 2 | Bangalore Rajarajeshwari Nagar | 12.927441 | 77.515522 |
| 90 | Nagarbhavi | 1 | Bangalore Nagarbhavi | 12.954674 | 77.512172 |
| 91 | Peenya | 1 | Bangalore Peenya | 13.032942 | 77.527325 |
91 rows × 5 columns
basemap=generateBaseMap()
HeatMap(north_india[['lan','lon','count']].values.tolist(),zoom=20,radius=15).add_to(basemap)
basemap
df3= df[df['cuisines']=='South Indian']
south_india=df2.groupby(['location'],as_index=False)['url'].agg('count')
south_india.columns=['Name','count']
south_india=south_india.merge(locations,on="Name",how='left').dropna()
south_india['lan'],south_india['lon']=zip(*south_india['geo_loc'].values)
south_india=south_india.drop(['geo_loc'],axis=1)
south_india.head()
| Name | count | new_Name | lan | lon | |
|---|---|---|---|---|---|
| 0 | BTM | 262 | Bangalore BTM | 45.954851 | -112.496595 |
| 1 | Banashankari | 35 | Bangalore Banashankari | 15.887678 | 75.704678 |
| 2 | Banaswadi | 9 | Bangalore Banaswadi | 13.014162 | 77.651854 |
| 3 | Bannerghatta Road | 60 | Bangalore Bannerghatta Road | 12.887979 | 77.597081 |
| 4 | Basavanagudi | 17 | Bangalore Basavanagudi | 12.941726 | 77.575502 |
basemap=generateBaseMap()
HeatMap(south_india[['lan','lon','count']].values.tolist(),zoom=20,radius=15).add_to(basemap)
basemap
df.head()
| url | address | name | online_order | book_table | rate | votes | phone | location | rest_type | dish_liked | cuisines | approx_cost(for two people) | reviews_list | menu_item | listed_in(type) | listed_in(city) | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | https://www.zomato.com/bangalore/jalsa-banasha... | 942, 21st Main Road, 2nd Stage, Banashankari, ... | Jalsa | Yes | Yes | 4.1 | 775 | 080 42297555\r\n+91 9743772233 | Banashankari | Casual Dining | Pasta, Lunch Buffet, Masala Papad, Paneer Laja... | North Indian, Mughlai, Chinese | 800 | [('Rated 4.0', 'RATED\n A beautiful place to ... | [] | Buffet | Banashankari |
| 1 | https://www.zomato.com/bangalore/spice-elephan... | 2nd Floor, 80 Feet Road, Near Big Bazaar, 6th ... | Spice Elephant | Yes | No | 4.1 | 787 | 080 41714161 | Banashankari | Casual Dining | Momos, Lunch Buffet, Chocolate Nirvana, Thai G... | Chinese, North Indian, Thai | 800 | [('Rated 4.0', 'RATED\n Had been here for din... | [] | Buffet | Banashankari |
| 2 | https://www.zomato.com/SanchurroBangalore?cont... | 1112, Next to KIMS Medical College, 17th Cross... | San Churro Cafe | Yes | No | 3.8 | 918 | +91 9663487993 | Banashankari | Cafe, Casual Dining | Churros, Cannelloni, Minestrone Soup, Hot Choc... | Cafe, Mexican, Italian | 800 | [('Rated 3.0', "RATED\n Ambience is not that ... | [] | Buffet | Banashankari |
| 3 | https://www.zomato.com/bangalore/addhuri-udupi... | 1st Floor, Annakuteera, 3rd Stage, Banashankar... | Addhuri Udupi Bhojana | No | No | 3.7 | 88 | +91 9620009302 | Banashankari | Quick Bites | Masala Dosa | South Indian, North Indian | 300 | [('Rated 4.0', "RATED\n Great food and proper... | [] | Buffet | Banashankari |
| 4 | https://www.zomato.com/bangalore/grand-village... | 10, 3rd Floor, Lakshmi Associates, Gandhi Baza... | Grand Village | No | No | 3.8 | 166 | +91 8026612447\r\n+91 9901210005 | Basavanagudi | Casual Dining | Panipuri, Gol Gappe | North Indian, Rajasthani | 600 | [('Rated 4.0', 'RATED\n Very good restaurant ... | [] | Buffet | Banashankari |
df['reviews_list'][0]
'[(\'Rated 4.0\', \'RATED\\n A beautiful place to dine in.The interiors take you back to the Mughal era. The lightings are just perfect.We went there on the occasion of Christmas and so they had only limited items available. But the taste and service was not compromised at all.The only complaint is that the breads could have been better.Would surely like to come here again.\'), (\'Rated 4.0\', \'RATED\\n I was here for dinner with my family on a weekday. The restaurant was completely empty. Ambience is good with some good old hindi music. Seating arrangement are good too. We ordered masala papad, panner and baby corn starters, lemon and corrionder soup, butter roti, olive and chilli paratha. Food was fresh and good, service is good too. Good for family hangout.\\nCheers\'), (\'Rated 2.0\', \'RATED\\n Its a restaurant near to Banashankari BDA. Me along with few of my office friends visited to have buffet but unfortunately they only provide veg buffet. On inquiring they said this place is mostly visited by vegetarians. Anyways we ordered ala carte items which took ages to come. Food was ok ok. Definitely not visiting anymore.\'), (\'Rated 4.0\', \'RATED\\n We went here on a weekend and one of us had the buffet while two of us took Ala Carte. Firstly the ambience and service of this place is great! The buffet had a lot of items and the good was good. We had a Pumpkin Halwa intm the dessert which was amazing. Must try! The kulchas are great here. Cheers!\'), (\'Rated 5.0\', \'RATED\\n The best thing about the place is itÃ\x83\\x83Ã\x82\\x83Ã\x83\\x82Ã\x82\\x82Ã\x83\\x83Ã\x82\\x82Ã\x83\\x82Ã\x82\\x92s ambiance. Second best thing was yummy ? food. We try buffet and buffet food was not disappointed us.\\nTest ?. ?? ?? ?? ?? ??\\nQuality ?. ??????????.\\nService: Staff was very professional and friendly.\\n\\nOverall experience was excellent.\\n\\nsubirmajumder85.wixsite.com\'), (\'Rated 5.0\', \'RATED\\n Great food and pleasant ambience. Expensive but Coll place to chill and relax......\\n\\nService is really very very good and friendly staff...\\n\\nFood : 5/5\\nService : 5/5\\nAmbience :5/5\\nOverall :5/5\'), (\'Rated 4.0\', \'RATED\\n Good ambience with tasty food.\\nCheese chilli paratha with Bhutta palak methi curry is a good combo.\\nLemon Chicken in the starters is a must try item.\\nEgg fried rice was also quite tasty.\\nIn the mocktails, recommend "Alice in Junoon". Do not miss it.\'), (\'Rated 4.0\', \'RATED\\n You canÃ\x83\\x83Ã\x82\\x83Ã\x83\\x82Ã\x82\\x82Ã\x83\\x83Ã\x82\\x82Ã\x83\\x82Ã\x82\\x92t go wrong with Jalsa. Never been a fan of their buffet and thus always order alacarteÃ\x83\\x83Ã\x82\\x83Ã\x83\\x82Ã\x82\\x82Ã\x83\\x83Ã\x82\\x82Ã\x83\\x82Ã\x82\\x92. Service at times can be on the slower side but food is worth the wait.\'), (\'Rated 5.0\', \'RATED\\n Overdelighted by the service and food provided at this place. A royal and ethnic atmosphere builds a strong essence of being in India and also the quality and taste of food is truly authentic. I would totally recommend to visit this place once.\'), (\'Rated 4.0\', \'RATED\\n The place is nice and comfortable. Food wise all jalea outlets maintain a good standard. The soya chaap was a standout dish. Clearly one of trademark dish as per me and a must try.\\n\\nThe only concern is the parking. It very congested and limited to just 5cars. The basement parking is very steep and makes it cumbersome\'), (\'Rated 4.0\', \'RATED\\n The place is nice and comfortable. Food wise all jalea outlets maintain a good standard. The soya chaap was a standout dish. Clearly one of trademark dish as per me and a must try.\\n\\nThe only concern is the parking. It very congested and limited to just 5cars. The basement parking is very steep and makes it cumbersome\'), (\'Rated 4.0\', \'RATED\\n The place is nice and comfortable. Food wise all jalea outlets maintain a good standard. The soya chaap was a standout dish. Clearly one of trademark dish as per me and a must try.\\n\\nThe only concern is the parking. It very congested and limited to just 5cars. The basement parking is very steep and makes it cumbersome\')]'
data=df['reviews_list'][0].lower()
data
'[(\'rated 4.0\', \'rated\\n a beautiful place to dine in.the interiors take you back to the mughal era. the lightings are just perfect.we went there on the occasion of christmas and so they had only limited items available. but the taste and service was not compromised at all.the only complaint is that the breads could have been better.would surely like to come here again.\'), (\'rated 4.0\', \'rated\\n i was here for dinner with my family on a weekday. the restaurant was completely empty. ambience is good with some good old hindi music. seating arrangement are good too. we ordered masala papad, panner and baby corn starters, lemon and corrionder soup, butter roti, olive and chilli paratha. food was fresh and good, service is good too. good for family hangout.\\ncheers\'), (\'rated 2.0\', \'rated\\n its a restaurant near to banashankari bda. me along with few of my office friends visited to have buffet but unfortunately they only provide veg buffet. on inquiring they said this place is mostly visited by vegetarians. anyways we ordered ala carte items which took ages to come. food was ok ok. definitely not visiting anymore.\'), (\'rated 4.0\', \'rated\\n we went here on a weekend and one of us had the buffet while two of us took ala carte. firstly the ambience and service of this place is great! the buffet had a lot of items and the good was good. we had a pumpkin halwa intm the dessert which was amazing. must try! the kulchas are great here. cheers!\'), (\'rated 5.0\', \'rated\\n the best thing about the place is itã\x83\\x83ã\x82\\x83ã\x83\\x82ã\x82\\x82ã\x83\\x83ã\x82\\x82ã\x83\\x82ã\x82\\x92s ambiance. second best thing was yummy ? food. we try buffet and buffet food was not disappointed us.\\ntest ?. ?? ?? ?? ?? ??\\nquality ?. ??????????.\\nservice: staff was very professional and friendly.\\n\\noverall experience was excellent.\\n\\nsubirmajumder85.wixsite.com\'), (\'rated 5.0\', \'rated\\n great food and pleasant ambience. expensive but coll place to chill and relax......\\n\\nservice is really very very good and friendly staff...\\n\\nfood : 5/5\\nservice : 5/5\\nambience :5/5\\noverall :5/5\'), (\'rated 4.0\', \'rated\\n good ambience with tasty food.\\ncheese chilli paratha with bhutta palak methi curry is a good combo.\\nlemon chicken in the starters is a must try item.\\negg fried rice was also quite tasty.\\nin the mocktails, recommend "alice in junoon". do not miss it.\'), (\'rated 4.0\', \'rated\\n you canã\x83\\x83ã\x82\\x83ã\x83\\x82ã\x82\\x82ã\x83\\x83ã\x82\\x82ã\x83\\x82ã\x82\\x92t go wrong with jalsa. never been a fan of their buffet and thus always order alacarteã\x83\\x83ã\x82\\x83ã\x83\\x82ã\x82\\x82ã\x83\\x83ã\x82\\x82ã\x83\\x82ã\x82\\x92. service at times can be on the slower side but food is worth the wait.\'), (\'rated 5.0\', \'rated\\n overdelighted by the service and food provided at this place. a royal and ethnic atmosphere builds a strong essence of being in india and also the quality and taste of food is truly authentic. i would totally recommend to visit this place once.\'), (\'rated 4.0\', \'rated\\n the place is nice and comfortable. food wise all jalea outlets maintain a good standard. the soya chaap was a standout dish. clearly one of trademark dish as per me and a must try.\\n\\nthe only concern is the parking. it very congested and limited to just 5cars. the basement parking is very steep and makes it cumbersome\'), (\'rated 4.0\', \'rated\\n the place is nice and comfortable. food wise all jalea outlets maintain a good standard. the soya chaap was a standout dish. clearly one of trademark dish as per me and a must try.\\n\\nthe only concern is the parking. it very congested and limited to just 5cars. the basement parking is very steep and makes it cumbersome\'), (\'rated 4.0\', \'rated\\n the place is nice and comfortable. food wise all jalea outlets maintain a good standard. the soya chaap was a standout dish. clearly one of trademark dish as per me and a must try.\\n\\nthe only concern is the parking. it very congested and limited to just 5cars. the basement parking is very steep and makes it cumbersome\')]'
import re
data2=re.sub('[^a-zA-Z]',' ',data)
data2
' rated rated n a beautiful place to dine in the interiors take you back to the mughal era the lightings are just perfect we went there on the occasion of christmas and so they had only limited items available but the taste and service was not compromised at all the only complaint is that the breads could have been better would surely like to come here again rated rated n i was here for dinner with my family on a weekday the restaurant was completely empty ambience is good with some good old hindi music seating arrangement are good too we ordered masala papad panner and baby corn starters lemon and corrionder soup butter roti olive and chilli paratha food was fresh and good service is good too good for family hangout ncheers rated rated n its a restaurant near to banashankari bda me along with few of my office friends visited to have buffet but unfortunately they only provide veg buffet on inquiring they said this place is mostly visited by vegetarians anyways we ordered ala carte items which took ages to come food was ok ok definitely not visiting anymore rated rated n we went here on a weekend and one of us had the buffet while two of us took ala carte firstly the ambience and service of this place is great the buffet had a lot of items and the good was good we had a pumpkin halwa intm the dessert which was amazing must try the kulchas are great here cheers rated rated n the best thing about the place is it x x x x x x x x s ambiance second best thing was yummy food we try buffet and buffet food was not disappointed us ntest nquality nservice staff was very professional and friendly n noverall experience was excellent n nsubirmajumder wixsite com rated rated n great food and pleasant ambience expensive but coll place to chill and relax n nservice is really very very good and friendly staff n nfood nservice nambience noverall rated rated n good ambience with tasty food ncheese chilli paratha with bhutta palak methi curry is a good combo nlemon chicken in the starters is a must try item negg fried rice was also quite tasty nin the mocktails recommend alice in junoon do not miss it rated rated n you can x x x x x x x x t go wrong with jalsa never been a fan of their buffet and thus always order alacarte x x x x x x x x service at times can be on the slower side but food is worth the wait rated rated n overdelighted by the service and food provided at this place a royal and ethnic atmosphere builds a strong essence of being in india and also the quality and taste of food is truly authentic i would totally recommend to visit this place once rated rated n the place is nice and comfortable food wise all jalea outlets maintain a good standard the soya chaap was a standout dish clearly one of trademark dish as per me and a must try n nthe only concern is the parking it very congested and limited to just cars the basement parking is very steep and makes it cumbersome rated rated n the place is nice and comfortable food wise all jalea outlets maintain a good standard the soya chaap was a standout dish clearly one of trademark dish as per me and a must try n nthe only concern is the parking it very congested and limited to just cars the basement parking is very steep and makes it cumbersome rated rated n the place is nice and comfortable food wise all jalea outlets maintain a good standard the soya chaap was a standout dish clearly one of trademark dish as per me and a must try n nthe only concern is the parking it very congested and limited to just cars the basement parking is very steep and makes it cumbersome '
data3=re.sub('rated', ' ',data2)
data3
' n a beautiful place to dine in the interiors take you back to the mughal era the lightings are just perfect we went there on the occasion of christmas and so they had only limited items available but the taste and service was not compromised at all the only complaint is that the breads could have been better would surely like to come here again n i was here for dinner with my family on a weekday the restaurant was completely empty ambience is good with some good old hindi music seating arrangement are good too we ordered masala papad panner and baby corn starters lemon and corrionder soup butter roti olive and chilli paratha food was fresh and good service is good too good for family hangout ncheers n its a restaurant near to banashankari bda me along with few of my office friends visited to have buffet but unfortunately they only provide veg buffet on inquiring they said this place is mostly visited by vegetarians anyways we ordered ala carte items which took ages to come food was ok ok definitely not visiting anymore n we went here on a weekend and one of us had the buffet while two of us took ala carte firstly the ambience and service of this place is great the buffet had a lot of items and the good was good we had a pumpkin halwa intm the dessert which was amazing must try the kulchas are great here cheers n the best thing about the place is it x x x x x x x x s ambiance second best thing was yummy food we try buffet and buffet food was not disappointed us ntest nquality nservice staff was very professional and friendly n noverall experience was excellent n nsubirmajumder wixsite com n great food and pleasant ambience expensive but coll place to chill and relax n nservice is really very very good and friendly staff n nfood nservice nambience noverall n good ambience with tasty food ncheese chilli paratha with bhutta palak methi curry is a good combo nlemon chicken in the starters is a must try item negg fried rice was also quite tasty nin the mocktails recommend alice in junoon do not miss it n you can x x x x x x x x t go wrong with jalsa never been a fan of their buffet and thus always order alacarte x x x x x x x x service at times can be on the slower side but food is worth the wait n overdelighted by the service and food provided at this place a royal and ethnic atmosphere builds a strong essence of being in india and also the quality and taste of food is truly authentic i would totally recommend to visit this place once n the place is nice and comfortable food wise all jalea outlets maintain a good standard the soya chaap was a standout dish clearly one of trademark dish as per me and a must try n nthe only concern is the parking it very congested and limited to just cars the basement parking is very steep and makes it cumbersome n the place is nice and comfortable food wise all jalea outlets maintain a good standard the soya chaap was a standout dish clearly one of trademark dish as per me and a must try n nthe only concern is the parking it very congested and limited to just cars the basement parking is very steep and makes it cumbersome n the place is nice and comfortable food wise all jalea outlets maintain a good standard the soya chaap was a standout dish clearly one of trademark dish as per me and a must try n nthe only concern is the parking it very congested and limited to just cars the basement parking is very steep and makes it cumbersome '
data4=re.sub('x',' ',data3)
data4
' n a beautiful place to dine in the interiors take you back to the mughal era the lightings are just perfect we went there on the occasion of christmas and so they had only limited items available but the taste and service was not compromised at all the only complaint is that the breads could have been better would surely like to come here again n i was here for dinner with my family on a weekday the restaurant was completely empty ambience is good with some good old hindi music seating arrangement are good too we ordered masala papad panner and baby corn starters lemon and corrionder soup butter roti olive and chilli paratha food was fresh and good service is good too good for family hangout ncheers n its a restaurant near to banashankari bda me along with few of my office friends visited to have buffet but unfortunately they only provide veg buffet on inquiring they said this place is mostly visited by vegetarians anyways we ordered ala carte items which took ages to come food was ok ok definitely not visiting anymore n we went here on a weekend and one of us had the buffet while two of us took ala carte firstly the ambience and service of this place is great the buffet had a lot of items and the good was good we had a pumpkin halwa intm the dessert which was amazing must try the kulchas are great here cheers n the best thing about the place is it s ambiance second best thing was yummy food we try buffet and buffet food was not disappointed us ntest nquality nservice staff was very professional and friendly n noverall e perience was e cellent n nsubirmajumder wi site com n great food and pleasant ambience e pensive but coll place to chill and rela n nservice is really very very good and friendly staff n nfood nservice nambience noverall n good ambience with tasty food ncheese chilli paratha with bhutta palak methi curry is a good combo nlemon chicken in the starters is a must try item negg fried rice was also quite tasty nin the mocktails recommend alice in junoon do not miss it n you can t go wrong with jalsa never been a fan of their buffet and thus always order alacarte service at times can be on the slower side but food is worth the wait n overdelighted by the service and food provided at this place a royal and ethnic atmosphere builds a strong essence of being in india and also the quality and taste of food is truly authentic i would totally recommend to visit this place once n the place is nice and comfortable food wise all jalea outlets maintain a good standard the soya chaap was a standout dish clearly one of trademark dish as per me and a must try n nthe only concern is the parking it very congested and limited to just cars the basement parking is very steep and makes it cumbersome n the place is nice and comfortable food wise all jalea outlets maintain a good standard the soya chaap was a standout dish clearly one of trademark dish as per me and a must try n nthe only concern is the parking it very congested and limited to just cars the basement parking is very steep and makes it cumbersome n the place is nice and comfortable food wise all jalea outlets maintain a good standard the soya chaap was a standout dish clearly one of trademark dish as per me and a must try n nthe only concern is the parking it very congested and limited to just cars the basement parking is very steep and makes it cumbersome '
re.sub(' +',' ',data4)
' n a beautiful place to dine in the interiors take you back to the mughal era the lightings are just perfect we went there on the occasion of christmas and so they had only limited items available but the taste and service was not compromised at all the only complaint is that the breads could have been better would surely like to come here again n i was here for dinner with my family on a weekday the restaurant was completely empty ambience is good with some good old hindi music seating arrangement are good too we ordered masala papad panner and baby corn starters lemon and corrionder soup butter roti olive and chilli paratha food was fresh and good service is good too good for family hangout ncheers n its a restaurant near to banashankari bda me along with few of my office friends visited to have buffet but unfortunately they only provide veg buffet on inquiring they said this place is mostly visited by vegetarians anyways we ordered ala carte items which took ages to come food was ok ok definitely not visiting anymore n we went here on a weekend and one of us had the buffet while two of us took ala carte firstly the ambience and service of this place is great the buffet had a lot of items and the good was good we had a pumpkin halwa intm the dessert which was amazing must try the kulchas are great here cheers n the best thing about the place is it s ambiance second best thing was yummy food we try buffet and buffet food was not disappointed us ntest nquality nservice staff was very professional and friendly n noverall e perience was e cellent n nsubirmajumder wi site com n great food and pleasant ambience e pensive but coll place to chill and rela n nservice is really very very good and friendly staff n nfood nservice nambience noverall n good ambience with tasty food ncheese chilli paratha with bhutta palak methi curry is a good combo nlemon chicken in the starters is a must try item negg fried rice was also quite tasty nin the mocktails recommend alice in junoon do not miss it n you can t go wrong with jalsa never been a fan of their buffet and thus always order alacarte service at times can be on the slower side but food is worth the wait n overdelighted by the service and food provided at this place a royal and ethnic atmosphere builds a strong essence of being in india and also the quality and taste of food is truly authentic i would totally recommend to visit this place once n the place is nice and comfortable food wise all jalea outlets maintain a good standard the soya chaap was a standout dish clearly one of trademark dish as per me and a must try n nthe only concern is the parking it very congested and limited to just cars the basement parking is very steep and makes it cumbersome n the place is nice and comfortable food wise all jalea outlets maintain a good standard the soya chaap was a standout dish clearly one of trademark dish as per me and a must try n nthe only concern is the parking it very congested and limited to just cars the basement parking is very steep and makes it cumbersome n the place is nice and comfortable food wise all jalea outlets maintain a good standard the soya chaap was a standout dish clearly one of trademark dish as per me and a must try n nthe only concern is the parking it very congested and limited to just cars the basement parking is very steep and makes it cumbersome '
dataset=df[df['rest_type']=='Quick Bites']
type(dataset['reviews_list'][3])
str
total_review=' '
for review in dataset['reviews_list']:
review=review.lower()
review=re.sub('[^a-zA-Z]', ' ',review)
review=re.sub('rated', ' ',review)
review=re.sub('x',' ',review)
review=re.sub(' +',' ',review)
total_review=total_review + str(review)
from wordcloud import WordCloud
wordcloud = WordCloud(width = 800, height = 800,
background_color ='white',
stopwords = stopwords,
min_font_size = 10).generate(total_review)
# plot the WordCloud image
plt.figure(figsize = (8, 8))
plt.imshow(wordcloud)
plt.axis("off")
def importance(restaurant):
dataset=df[df['rest_type']==restaurant]
total_review=' '
for review in dataset['reviews_list']:
review=review.lower()
review=re.sub('[^a-zA-Z]', ' ',review)
review=re.sub('rated', ' ',review)
review=re.sub('x',' ',review)
review=re.sub(' +',' ',review)
total_review=total_review + str(review)
wordcloud = WordCloud(width = 800, height = 800,
background_color ='white',
stopwords = set(STOPWORDS),
min_font_size = 10).generate(total_review)
# plot the WordCloud image
plt.figure(figsize = (8, 8))
plt.imshow(wordcloud)
plt.axis("off")
importance('Quick Bites')
!jupyter nbconvert --to html Youtube_data_analysis.ipynb